#define _CRT_SECURE_NO_WARNINGS 1
#include <stdio.h>
void reverse(char* s, int len)
{
	char* l = s;
	char* r = s + len - 1;
	char tmp;
	while (l <= r)
	{
		tmp = *l;
		*l = *r;
		*r = tmp;
		l++;
		r--;
	}
}
int main()
{
	int T;
	scanf("%d", &T);
	while (T--)
	{
		char s[]="0";
		scanf("%s", &s);
		int len = strlen(s);
		for (int i = 1; i <= len; i++)
		{
			reverse(s, i);
		}
		printf("%s\n", s);
	}
	return 0;
}